<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <title>我的车辆</title>
    <link rel="stylesheet" href="${ctx}/static/plug/frozenui-1.3.0/css/frozen.css" media="all">
    <link rel="stylesheet" href="${ctx}/static/css/user/myCarNo.css" media="all">
</head>
<body ontouchstart="">
<section class="ui-container">
    <div class="ui-flex ui-flex-ver ui-flex-pack-center ui-flex-align-start  ui-flex-align-center ui-flex-pack-center">
        <input type="hidden" id="hidMyCarNum" value="${fn:length(userCars)} "/>
		<h3 align="center" style="padding-top: 20px">请选择需要领券的车牌</h3>
        <c:if test="${userCars != null &&  fn:length(userCars) > 0 }">
            <div style="padding-top: 20px"></div>
            <c:forEach var="userCar" items="${userCars}">
                <div class=" ui-flex ui-flex-pack-center ui-flex-align-center" style="padding-top: 10px"
                     id="div_carno_${userCar.id}" onclick="receiveCoupon('${userCar.carNo}')">
                    <div class="carno-div  ui-flex ui-flex-pack-center ui-flex-align-center">
                        <div class="carno-text-div" >
                          <div style="margin:0 auto;width:100%">${userCar.carNo}</div>
                        </div>
                    </div>
                </div>
            </c:forEach>
        </c:if>

        <c:if test="${userCars == null ||  fn:length(userCars) == 0 }">
            <div class="ui-flex ui-flex-ver ui-flex-pack-center ui-flex-align-start"
                 style="height: 450px; overflow: auto; background-color: #f8f8f8">
                <div id="noUnpayDiv" class="div-noUnpay">
                    <div>
                        <img alt="" src="${ctx}/static/image/recharge/nodata.png" width="150px">
                    </div>
                    <div class="div-text" style="padding-top: 20px">无绑定车辆</div>
                </div>
            </div>
        </c:if>

        <div class="ui-flex ui-flex-ver ui-flex-pack-center ui-flex-align-start"
             style="height: 450px; overflow: auto; background-color: #f8f8f8;display:none" id="divNoCar">
            <div class="div-noUnpay">
                <div>
                    <img alt="" src="${ctx}/static/image/recharge/nodata.png" width="150px">
                </div>
                <div class="div-text" style="padding-top: 20px">无绑定车辆</div>
            </div>
        </div>

    </div>
    <div class="ui-footer ui-footer-stable ui-btn-group ui-border-t" onclick="funcAddCarNo()"
         style="background-color: #FFF">
        <button class="ui-btn-lg ui-btn-primary" id="btnAddCarNo">添加车辆</button>
    </div>
    <div class="ui-actionsheet">
        <div class="ui-actionsheet-cnt">
            <button class="ui-actionsheet-del" onclick="funcAddCarNo()">确认</button>
            <button onclick="cancelConfirm()">取消</button>
        </div>
    </div>
</section>


</body>
<script src="${ctx}/static/plug/frozenui-1.3.0/js/frozen.js"></script>
<script>
    var paramObj = {
        "addMyCarNoParams": "${addMyCarNoParams}",
        "generateCouponParams" : "${generateCouponParams}",
        "userCouponEncryptStr" :"${userCouponEncryptStr}",
        "userId" :"${userId}"
    };
    

    function funcAddCarNo() {
    	var hrefUrl = "${action}?params=" + paramObj.addMyCarNoParams + "&userCouponEncryptStr=" + paramObj.userCouponEncryptStr;
        window.location.replace(hrefUrl);
    }
   

    function receiveCoupon(val) {
    	var hrefUrl = "${action}?params="+ paramObj.generateCouponParams +"&userId=" + paramObj.userId + "&carNo=" + val;
    	window.location.replace(hrefUrl);
	}

    function cancelConfirm() {
        $('.ui-dialog').removeClass('show');
    }

   
</script>
</html>